package com.wtwd.device.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wtwd.device.dao.AlarmHealthMapper;
import com.wtwd.device.model.entity.AlarmHealth;
import com.wtwd.device.service.AlarmHealthService;
import com.wtwd.device.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AlarmHealthServiceImpl implements AlarmHealthService {
    /**
     * 一天的时间戳
     */
    private Long oneTime = 86400000L;
    @Autowired
    private AlarmHealthMapper alarmHealthMapper;
    @Override
    public List<AlarmHealth> getAlarmRecordList(Integer currentPage, Integer pageSize,String date) {
        IPage<AlarmHealth> page = new Page<>(currentPage,pageSize);
        Long startTime = DateUtils.stringToTimestamp(date, DateUtils.dateFormat18);
        Long endTime = startTime + oneTime;
        return alarmHealthMapper.getAlarmRecordList(page,startTime,endTime);
    }
}
